﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;

namespace TestEmail
{
    class Program
    {
        static void Main(string[] args)
        {
            bool SmtpRequireCredentials = false;
            bool SmtpUseSSL = false;
            string SmtpServerHost = "cluster2out.ap.messagelabs.com";
            int SmtpServerPort = 25;
            string SmtpCredentialUsername = "******@gmail.com";
            string SmtpCredentialPassword = "********";


            #region using gmail smtp 
            //var client = new SmtpClient("smtp.gmail.com", 587)
            //{
            //    Credentials = new NetworkCredential("******@gmail.com", "********"),
            //    EnableSsl = true
            //};
            #endregion using gmail smtp



            var client = new SmtpClient("cluster2out.ap.messagelabs.com", 25);
            //{
            //    Credentials = new NetworkCredential("******@gmail.com", "********"),
            //    EnableSsl = true
            //};

            SmtpClient smtp = new SmtpClient(SmtpServerHost, SmtpServerPort);
            smtp.EnableSsl = SmtpUseSSL;
            if (SmtpRequireCredentials)
            {
                smtp.Credentials = new NetworkCredential(SmtpCredentialUsername, SmtpCredentialPassword);
            }
            

            client.Send("Notifybot@kepland.com", "zhixian.ong@kepland.com.sg", "test", "testbody");
            Console.WriteLine("Sent");
            Console.ReadLine();
        }
    }
}
